home *** CD-ROM | disk | FTP | other *** search
- * Last change: MIB 8 Nov 93 3:36 pm
-
- procedure PARTEDIT
- * P A R T E D I T
- * Routine to process Parts Records
- parameters TOP, LEFT, NROWS, MODE
- * do PARTEDIT with TOP, LEFT, NROWS, MODE
- private PARTFUNC, OLDSCR, WIDTH
-
- save screen to OLDSCR
- PARTFUNC = "PARTUPDAT"
- WIDTH = 38
- PARTPICS[1] = replicate("X",24)
- MPARTSPEC = "P"
- select PARTLINE
-
- MADD = (reccount()=0)
- go top
- do while .not. GETOUT
- do PARTPRMT
- DBEDIT(TOP,LEFT,TOP+NROWS-2,LEFT+WIDTH-1,PARTFLDS,PARTFUNC,PARTPICS,PARTHDRS,chr(196),chr(179),.t.,"")
- enddo
- set color to (COLNORM)
- set deleted off
- replace PLINENO with recno() all
- set deleted on
- GETOUT = .f.
- do PGETSPEC
- restore screen from OLDSCR
- return
-
- *********************************************************************
-
- function PARTUPDAT
- parameters MODE, FLD_PTR
- private SCRBOT, RETVAL, ROWNO, COLNO
- rowno = row()
- colno = col()
- SCRBOT = ""
- ADDREC = .f.
- QBKEY = lastkey()
- RETVAL = 1
-
- do case
- case QBKEY=27
- QBRESP = "Q"
- case MODE=3 .or. MODE=2 && Empty, past bottom
- MPLINENO = PARTLINE->PLINENO + 1
- MADD = .t.
- keyboard replicate(chr(19),FLD_PTR-1)
- return 3
- case MODE<4
- return 1
- *case QBKEY=-2 && F3
- * replace PARTSPEC with "S"
- * QBRESP="I"
- *case QBKEY=-3 && F4
- * replace PARTSPEC with "P"
- * QBRESP="I"
- case QBKEY=13
- save screen
- CURFLD = PARTFLDS[FLD_PTR]
- MEDSTR = PARTLINE->&CURFLD
- set color to (COLFLASH)
- @ ROWNO, COLNO say MEDSTR picture PARTPICS[FLD_PTR]
- QBRESP = iif(QBYESNO("Edit this Field?")="Y","E","I")
- set color to (COLBRIGHT)
- restore screen
- case QBKEY=-9 && F10
- * ACTION = QBPROMPT("Ignore|Edit|Add|Delete|Restore all|Parts "+chr(29)+" Specialist|Quit|","",6)
- ACTION = QBPROMPT("Ignore|Edit|Delete|Restore all|Quit|","",6)
- otherwise
- QBRESP = "E"
- keyboard chr(QBKEY)
- endcase
-
- set color to (COLBRIGHT)
-
- DO CASE
- *CASE QBRESP="A" && Add one
- * RETVAL = 3
- case QBRESP="D"
- save screen
- CURFLD = PARTFLDS[FLD_PTR]
- MEDSTR = PARTLINE->&CURFLD
- set color to (COLFLASH)
- @ ROWNO, COLNO say MEDSTR picture PARTPICS[FLD_PTR]
- if QBYESNO("Delete this line?")="Y"
- delete
- endif
- set color to (COLBRIGHT)
- restore screen
- skip 1
- skip -1
- keyboard chr(19)+chr(24)
- RETVAL = 2
- case QBRESP="E" && Normal Selection by CR
- do PARTGET with RETVAL,ROWNO,COLNO, FLD_PTR
- QBRESP = iif(GETOUT,"Q"," ")
- *case QBRESP="P"
- * if MPARTSPEC="P"
- * MPARTSPEC = "S"
- * do QBMESS with "Now Entering Specialist Materials",COLFLASH,5
- * else
- * MPARTSPEC = "P"
- * do QBMESS with "Now Entering Parts",COLFLASH,5
- * endif
- case QBRESP="R"
- if QBYESNO("Restore all deleted lines?")="Y"
- set deleted off
- recall all for deleted()
- go top
- set color to (COLBRIGHT)
- RETVAL = 2
- set deleted on
- endif
- otherwise
- GETOUT = .f.
- ENDCASE
-
- if QBRESP="Q"
- GETOUT = (QBYESNO("Finished editing Parts?")="Y")
- MADD = .f.
- endif
-
- if .not. GETOUT
- do PARTPRMT
- if FLD_PTR>2
- SCRBOT = replicate(chr(19),3) + iif(MADD,chr(24),"")
- else
- SCRBOT = chr(4)
- endif
- keyboard SCRBOT
- endif
- set color to (COLBRIGHT)
-
- @ 23,1 clear to 23,38
-
- return iif(GETOUT,0,RETVAL)
-
- *********************************************************************
-
- procedure PARTGET
- parameters RETVAL, ROWNO, COLNO, FLD_PTR
-
- PARTFILL()
-
- do case
- case FLD_PTR=1
- @ ROWNO, COLNO get MPARTDESC picture "@S24"
- do QBREAD with "Enter Description",""
- case FLD_PTR=2
- @ ROWNO, COLNO get MQTY picture "99"
- do QBREAD with "Enter Quantity",""
- case FLD_PTR=3
- @ ROWNO, COLNO get MUPRICE picture "9999.99"
- do QBREAD with "Enter Unit Price",""
- otherwise
- ?? chr(7)
- endcase
-
- if .not. GETOUT
- if MPLINENO>reccount()
- append blank
- replace INVNO with MINVNO, PLINENO with MPLINENO, PARTSPEC with MPARTSPEC
- RETVAL = 1
- endif
- do case
- case FLD_PTR=1
- replace PARTDESC with MPARTDESC
- case FLD_PTR=2
- replace QTY with MQTY, TPRICE with UPRICE * QTY
- case FLD_PTR=3
- replace UPRICE with MUPRICE, TPRICE with UPRICE * QTY
- endcase
- if MADD
- MADD = (lastkey()<>3) && PgDn
- endif
- else
- RETVAL = 0
- endif
-
- return
-
- *********************************************************************
-
- procedure PARTPRMT
- * PARTPRMT
- private M
- do QBCLMESS
- set color to (COLBRIGHT)
- M = "Move with "+chr(24)+" & "+chr(25)+[. Scroll PgUp/PgDn. Exit: ESC. Menu: F10]
- @ QBMSGLIN,centre(M,80) SAY M
- *M = "Enter Specialist Materials: F3, Parts: F4"
- *@ QBMSGLIN+1,centre(M,80) SAY M
-
- set color to (COLHEAD)
- @ 2,0 say iif(MADD,"Adding ","Editing")
- set color to (COLBRIGHT)
- return
-
- *********************************************************************
-
- function PARTLOAD
- * P A R T L O A D
- parameters PINVNO
- private STATUS, SELNO
- STATUS = 0
-
- select PARTLINE
- zap
-
- SELNO = select()
- use
-
- select PARTS
- set softseek off
- seek str(PINVNO,5)
- if found()
- copy to PARTLINE while PARTS->INVNO=PINVNO
- STATUS = 2
- endif
- select (SELNO)
- use PARTLINE
-
- return STATUS
-
- *********************************************************************
-
- procedure PARTSAVE
- parameters PINVNO
- private ZAPIT
- set deleted off
- do PARTDEL with PINVNO
-
- * Copy the records across
- select PARTLINE
- go top
- do while .not. eof()
- PARTFILL()
- if .not. deleted()
- select PARTS
- go top
- if PARTINFO()
- do QBADBLNK with 50
- go top
- endif
- replace PARTS->PARTDESC with MPARTDESC, PARTS->INVNO with MINVNO
- replace PARTS->PARTSPEC with MPARTSPEC, PARTS->QTY with MQTY
- replace PARTS->UPRICE with MUPRICE, TPRICE with MTPRICE, PARTS->PLINENO with MPLINENO
- endif
- select PARTLINE
- skip
- enddo
- set deleted on
- MINVNO = PINVNO
-
- return
-
- *********************************************************************
-
- function PARTFILL
-
- if INVNO<>0
- MINVNO = INVNO
- MPLINENO = PLINENO
- MPARTSPEC = PARTSPEC
- endif
- MPARTDESC = PARTDESC
- MTPRICE = TPRICE
- MUPRICE = UPRICE
- MQTY = QTY
-
- return PARTINFO()
-
- *********************************************************************
-
- function PARTINFO
-
- return TPRICE>0 .or. .not. empty(PARTDESC)
-
- *********************************************************************
-
- function PARTCLEAR
-
- MPARTDESC = space(40)
- MPARTSPEC = "P"
- store 0 to MQTY, MTPRICE, MUPRICE, MPLINENO
-
- return 0
- *********************************************************************
-
- procedure PARTSHOW
- * P A R T S H O W
- * Routine to process Parts Records
- parameters TOP, LEFT, NROWS
- * do PARTSHOW with TOP, LEFT, NROWS, MODE
- private PARTFUNC, OLDSCR, WIDTH
-
- PARTFUNC = .t.
- WIDTH = 38
- PARTPICS[1] = replicate("X",15)
-
- select PARTLINE
- go top
- keyboard chr(27)
- set color to (COLBRIGHT)
-
- DBEDIT(TOP,LEFT,TOP+NROWS-2,LEFT+WIDTH-1,PARTFLDS,PARTFUNC,PARTPICS,PARTHDRS,chr(196),chr(179),.t.,"")
-
- @ 23,1 clear to 23,38
-
- set color to (COLNORM)
-
- return
-
- *********************************************************************
-
- procedure PARTDEL
- parameters PINVNO
-
- * Get rid of the old stuff
- select PARTS
-
- set softseek off
- seek str(PINVNO,5)
- do while .not. eof() .and. PARTS->INVNO=PINVNO
- do QBWIPE
- seek str(PINVNO,5)
- enddo
-
- return
-
- ***********************************************************************
-
- procedure PGETSPEC
- * Input value for Paints and Materials
- if MINSTOPAY
- @ 8,62 get MINSSPEC picture "9999.99"
- else
- @ 8,71 get MOWNSPEC picture "9999.99"
- endif
- do QBREAD with "Enter Paints and Materials",""
- GETOUT = .f.
-
- return